﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DevExpress.Web.ASPxGridView;


public partial class Store_Manager_SM_POApproval : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        //if (!IsPostBack)
        //{
        //    ASPxGridView1.DataBind();
        //    ASPxGridView1.DetailRows.ExpandRow(0);
        //}
    }
    protected void detailGrid_DataSelect(object sender, EventArgs e)
    {
        try
        {
            Session["Or_ID"] = (sender as ASPxGridView).GetMasterRowKeyValue();
        }
        catch (Exception)
        {
        }
    }
    protected void ASPxButton1_Click(object sender, EventArgs e)
    {
        Bestlife.ERP.Entities.E_PurchaseOrder PO = new Bestlife.ERP.Entities.E_PurchaseOrder();
        string user = Session["username"].ToString();
        List<Object> orid = ASPxGridView1.GetSelectedFieldValues("Or_ID");
        if (orid.Count == 0)
        {
            ASPxLabel2.Visible = true;
            ASPxLabel2.Text = "Please select products ";
        }
        else
        {
            foreach (object selectorid in orid)
            {
                PO.Or_ID1= selectorid.ToString();
            }
        }
        PO.Approval = DropDownList1.Text;
        Bestlife.ERP.BusinessRules.B_PurchaseOrder.approvalPO(PO, user);
    }
}